//
//  UIColor+Hex.h
//  YuxiCloud
//
//  Created by LIUKUN-PC on 16/4/14.
//  Copyright © 2016年 ynnissi. All rights reserved.
//

#import <UIKit/UIKit.h>

#define ZX_WEAK_CELL(cell) __weak typeof(cell) weakCell = cell;
#define ZX_WEAK_SELF __weak typeof(self) weakSelf = self;
#define SCREEN_BOUNDS [[UIScreen mainScreen] bounds]
#define SCREEN_WIDTH  [[UIScreen mainScreen] bounds].size.width
#define SCREEN_HEIGHT [[UIScreen mainScreen] bounds].size.height
#define IMG_WIDTH  (SCREEN_WIDTH-40)/3.0+10
#define COLLECTIONCELL_HEIGHT ((SCREEN_WIDTH-20)/2.0 +20)
#define backgrCOlor [UIColor colorWithRed:(245)/255.0 green:(245)/255.0 blue:(245)/255.0 alpha:1]
#define SELF_WIDTH  (self.frame.size.width)
#define SELF_HEIGHT (self.frame.size.height)

#define SELF_VIEW_WIDTH  (self.view.frame.size.width)
#define SELF_VIEW_HEIGHT (self.view.frame.size.height)

/** 导航栏高度 */
#define NAVIGATION_HEIGHT (CGRectGetHeight([[UIApplication sharedApplication] statusBarFrame]) + CGRectGetHeight(self.navigationController.navigationBar.frame))
/** 按钮高度 */
#define BTN_HEIGHT   30
#define FONT_TWELVE [UIFont systemFontOfSize:12]
#define FONT_SIXTEEN [UIFont systemFontOfSize:16]
#define FONT_FOURTEEN [UIFont systemFontOfSize:14]
#define FONT_EIGHTEEN [UIFont systemFontOfSize:18]
#define COLOR_DIV      [UIColor colorWithHex:0x333333]
#define COLOR_LINE     [UIColor colorWithHex:0xf2f2f2]
//#define COLOR_DEFAULT  [UIColor colorWithHex:0x3399ff]
#define COLOR_BUTTON   [UIColor colorWithHex:0x66ccff]
#define COLOR_HOMEWORK_RED [UIColor colorWithHex:0xee5242]
#define COLOR_HOMEWORK_GREEN [UIColor colorWithHex:0x04b394]
#define COLOR_RESOURCE_DARK_GRAY [UIColor colorWithHex:0x404040]
#define COLOR_GREEN      [UIColor colorWithHex:0x29B566]
#define COLOR_ORG      [UIColor colorWithHex:0xff9e05]
#define COLOR_Gray     [UIColor colorWithHex:0x666666]

#define RECT_DIV      CGRectMake(0, 0, SCREEN_WIDTH, 10)
#define RECT_LINE      CGRectMake(0, 0, SCREEN_WIDTH, 1)

#define DOCUMENT_PATH (NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0])

#define STATUSBAR_HEIGHT ([[UIApplication sharedApplication] statusBarFrame].size.height)
#define NAVBAR_HEIGHT (STATUSBAR_HEIGHT+44)

/* 16进制颜色值*/

@interface UIColor (Hex)

+ (UIColor *)colorWithHex:(NSInteger)hexColor;

+ (UIColor *)colorWithHex:(NSInteger)hexColor alpha:(CGFloat)alpha;

@end


/* 生成纯色图片 */

@interface UIImage (Color)

+ (UIImage *)imageWithColor:(UIColor *)color;

@end

@interface UIViewController (StoryboardID)

/* 返回类名 */
+ (NSString *)storyboardID;

/* 从MianStoryboard初始化实例 */
+ (instancetype)viewControllerFromMainStoryboard;

/* 从指定的StoryboardName初始化实例 */
+ (instancetype)viewControllerFromStoryboadName:(NSString *)storyboardName;

@end


@interface UITableViewCell (ReuseID)

/* 返回类名, 用于Cell的ReuseID */
+ (NSString *)reuseID;

@end

@interface UICollectionViewCell (ReuseID)

/* 返回类名，用于Cell的ReuseID */
+ (NSString *)reuseID;

@end

@interface UIView (Storyboard)

/** 边框宽度 */
@property (nonatomic, assign) IBInspectable CGFloat borderWidth;

/** 边框颜色*/
@property (nonatomic, strong) IBInspectable UIColor *borderColor;

/** 圆角半径 */
@property (nonatomic, assign) IBInspectable CGFloat cornerRadius;

@end

@interface UIViewController (AlertView)

/** 显示AlertView*/
- (UIAlertController *)showAlertViewWithMessage:(NSString *)message cancelHandler:(void(^)())cancelBlock;

/** 显示AlertView 带提示*/
- (UIAlertController *)showAlertViewWithTitle:(NSString *)title message:(NSString *)message cancelHandler:(void(^)())cancelBlock;

/** 显示AlertView, 带输入 */
- (UIAlertController *)showTextFieldAlertViewWithTitle:(NSString *)title message:(NSString *)message completion:(void(^)(NSString *text))completion;

/** 显示AlertView, 带输入，自定义textField */
- (UIAlertController *)showTextFieldAlertViewWithTitle:(NSString *)title message:(NSString *)message configurationHandler:(void(^)(UITextField *textField))configurationHandler completion:(void(^)(NSString *text))completion;


@end

//文本缩减
@interface UITextField (TextIndent)


/**
 添加文本缩进,第一行缩进

 @param indent 缩进值
 */
- (void)addTextIndent:(CGFloat)indent;


/**
 添加文本缩进leftView

 @param indentFrame leftView的frame
 */
- (void)addTextIndentViewWithFrame:(CGRect)indentFrame;

@end



